Skip to content

feat: exporting AllRoutes set from generated ROUTES.ts#676

Merged
jycouet merged 7 commits intojycouet:mainfrom
duducpp:main
Jul 25, 2024
Merged

feat: exporting AllRoutes set from generated ROUTES.ts#676
jycouet merged 7 commits intojycouet:mainfrom
duducpp:main

Conversation

@duducpp
Copy link
Copy Markdown
Contributor

@duducpp duducpp commented Jul 17, 2024

This allows users to access all routes generated through a Set.

export type AllRoutes<T = AllTypes, K = keyof T> = K extends \`\${infer I1} \${infer I2}\` ? I2 : K
export const allRoutes = [... new Set(Object.keys(AllObjs).map((k) => /^\\/.*|[^ ]?\\/.*$/.exec(k)?.[0] ?? null))]

Result:

// type AllRoutes
"/" | "/route1" | "/route2/[alias]"

// const allRoutes
["/", "/route1", "/route2/[alias]"]

This allows users to import 'AllObjs' which contains all routes.
@duducpp duducpp changed the title feat: exporting AllObjs from generated ROUTES.ts feat: exporting AllRoutes set from generated ROUTES.ts Jul 17, 2024
@jycouet
Copy link
Copy Markdown
Owner

jycouet commented Jul 17, 2024

Looks good to me thx.

I don't have access to a laptop RN, I'll look at it next week. Hope it's ok for you.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Jul 25, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1c4ad59. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@jycouet
Copy link
Copy Markdown
Owner

jycouet commented Jul 25, 2024

@all-contributors please add @duducpp for code

@allcontributors
Copy link
Copy Markdown
Contributor

@jycouet

I've put up a pull request to add @duducpp! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants